home *** CD-ROM | disk | FTP | other *** search
- ADD.DOC
- 03/20/93
-
- The ADD.EXE program goes through a text file and adds up the numbers in specific
- columns. Invalid characters are ignored in the records (only digits, the
- decimal place, and the negative sign are processed). The routine presents some
- summary information about your file and also provides a relatively quick way of
- getting a record count for your file.
-
- Records in: ###
- Addable records: ###
- SUM: ###
- Minimum: ###
- Maximum: ###
-
-
- Syntax:
-
- The routine requires at least one parameter (the name of the text file to
- process) but also has other options:
-
- ADD infile [ /COLUMNS { col1-col2 | col1 colct } ]
- [ /LINES { line1-line2 | line1 linect } ... ]
- [ /V | /-V ] [ /I | /-I ] [ search ]
- [ /C | /-C ] [ /Q ] [ /? ]
-
- where:
-
- "infile" is the name of the file to process.
-
- "/COLUMNS col1-col2" says to restrict the search of that file to just those
- numbers found in the columns between col1 and col2 inclusive. So "ADD MYFILE
- /COLUMNS 1-10" would confine the search to just the numbers found in the first
- 10 characters of each record. Defaults to "/COLUMNS 1-100".
-
- "/COLUMNS col1 colct" says to restrict the search of that file to just those
- numbers found in the colct columns beginning with col1. For example, "ADD
- MYFILE /COLUMNS 10 5" will confine the search to just those numbers found in
- columns 10 to 14 (the 5 columns beginning will column 10) of each record.
-
-
- "/LINES line1-line2" says to restrict the search to lines between line numbers
- line1 and line2 inclusive. You can have multiple line requests in any order
- such as "/LINES 1-10 90-100 30-50". The routine skips all lines after the
- largest line number is encountered. Defaults to "/LINES 1-9999999".
-
- "/LINES line1 linect" says to restrict the search to lines beginning with line1
- and continuing for a total of linect lines. So "/LINES 10 20" is actually the
- same as "/LINES 10 29".
-
- "/V" says to find those items that do NOT match the specification.
-
- "/-V" is the opposite of /V and is typically the default; CONFIGWS-able.
-
- "/I" says to make it a case-insensitive search.
-
- "/-I" is the opposite of /I and is typically the default; CONFIGWS-able.
-
- "search" restricts the search to lines which meet some string search
- specification. The search itself is described below.
-
- "/C" skips adding up numbers in the file and simply gives you a record count for
- the file. /C and /COLUMNS are mutually exclusive; don't try both of them at
- once. /C operates very quickly if no string search or line restriction is made;
- it reads the file in in blocks and search for carriage return/line feed
- sequences.
-
- "/-C" is the opposite of /C and is typically the default; CONFIGWS-able.
-
- "/Q" turns off the block-by-block status messages.
-
- "/?" or "/HELP" or "HELP" shows you the syntax for the command.
-
-
- For search, the syntax is:
- [ ( ]... search_item [ boolean [ ( ]... search_item [ ) ]...] [ ) ]...
- where:
- ( and ) are used to group items
- search_item is shown below
- boolean is AND, OR, or XOR (NOT is included with search_item)
-
- for search_item, the syntax is:
- [ NOT ] "string" [ column ]
- where:
- NOT is obvious
- string the string to search; the quotation marks are typically not
- required unless the string contains a space or a reserved word
- column is the column in which the string must be found.
-
- So, let's cover some examples:
-
- ADD TEST.TXT "Bugs Bunny" OR "Elmer Fudd" /COLS=1-10
-
- Adds any numeric values in columns 1 to 10 in TEST.TXT that have the either the
- text "Bugs Bunny" or "Elmer Fudd" in them.
-
- ADD TEST2.TXT (Apples or Oranges) AND NOT Pears /LINES=1-1000 /COLS=1/5
-
- Adds any data in columns 1 to 5 of the first thousand lines of TEST2.TXT. The
- line itself must contain the words "Apples" or "Oranges" in them and any lines
- are ignored that contain "Pears". Note that the quotes around the search words
- are not required unless the words include spaces or unless they could be
- confused with some other keywords. "ADD TEST3.TXT OR OR AND" might cause the
- program to get confused since "OR" and "AND", which you want to look for as also
- keywords.
-
- ADD /I TEST.TXT "Bugs Bunny" AND Martians /C
-
- Gives you the number of lines containing both "Bugs Bunny" and "Martians". The
- search is case-insensitive so lines with either "BUGS BUNNY" or "Bugs Bunny"
- will be included. No addition is done since /C is provided.
-
-
- This program was written by Bruce Guthrie of Wayne Software. It is free for use
- provided relevant documentation is kept with the program, no changes are made to
- the program or documentation, and it is not bundled with commercial programs or
- charged for separately. People who need to bundle it in for-sale packages must
- pay a $50 registration fee to "Wayne Software" at the following address.
- Comments and suggestions can also be sent to:
-
- Bruce Guthrie
- Wayne Software
- 113 Sheffield St.
- Silver Spring, MD 20910
-
- fax: (301) 588-8986